package com.one.apartmentsystem.app.controller;
import com.one.apartmentsystem.app.service.BankInfoService;
import com.one.apartmentsystem.app.service.ContractInfoService;
import com.one.apartmentsystem.app.service.RentalInfoService;
import com.one.apartmentsystem.app.service.UserService;
import com.one.apartmentsystem.app.vo.HouseDetailsVO;
import com.one.apartmentsystem.common.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 签约接口
 * 用于处理签约相关操作，包括签约、续租、退租和转租等功能
 * @author mpk
 * @since 2024/8/9 18:25:30
 */
@RestController
@RequestMapping("/app/signup")
public class SignUpController {

    @Autowired
    private RentalInfoService rentalInfoService;
    @Autowired
    private BankInfoService bankInfoService;
    @Autowired
    private ContractInfoService contractInfoService;
    @Autowired
    private UserService userService;

    /**
     * 我的签约页面
     * 根据用户ID获取签约信息
     * @param userId 用户id
     * @return 签约信息列表
     */
    @GetMapping("/signup/{userId}")
    public Result getSignUp(@PathVariable String userId) {
        List<HouseDetailsVO> houseDetailsVO = rentalInfoService.getSingUp(userId);
        return Result.ok(houseDetailsVO);
    }

    /**
     * 续租操作
     * 根据合同ID进行续租处理
     * @param contractId 合同id
     * @return 续租结果
     */
    @GetMapping("/renew/{contractId}")
    public Result getRenew(@PathVariable String contractId) {
        return Result.ok();
    }

    /**
     * 退租操作
     * 根据合同ID进行退租处理
     * @param contractId 合同id
     * @return 退租结果
     */
    @GetMapping("/lease/{contractId}")
    public Result getLease(@PathVariable String contractId) {
//        bankInfoService.save()
        return Result.ok();
    }

    /**
     * 转租操作
     * 根据合同ID进行转租处理
     * @param contractId 合同id
     * @return 转租结果
     */
    @GetMapping("/transfer/{contractId}")
    public String getTransfer(@PathVariable String contractId) {
        return "transfer";
    }

    /**
     * 物业交割信息
     * 根据房屋ID获取物业交割信息
     * @param houseId 房屋id
     * @return 物业交割信息
     */
    @GetMapping("/property/{houseId}")
    public String getProperty(@PathVariable String houseId) {
        return "property";
    }

}
